package com.itheima.nio.buffer.demo04;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class NioClientDemo04 {

    public static void main(String[] args) throws IOException {

        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("127.0.0.1", 8787));
        ByteBuffer byteBuffer = ByteBuffer.wrap("hello".getBytes("UTF-8"));
        socketChannel.write(byteBuffer);
        socketChannel.close();

    }
}
